import request from '@/utils/request'

// 获取产品列表
export function getDataList() {
  return request({
    url: '/product/category/list/tree',
    method: 'get'
  })
}

// 删除产品
export function deleteCategory(catIds) {
  return request({
    url: "/product/category/delete",
    method: "post",
    data: catIds
  })
}


// 添加产品
export function addCategory(category) {
  return request({
    url: "/product/category/save",
    method: "post",
    data: category
  })
}

// 根据catId获取当前节点的数据
export function getCategoryByCatId(catId) {
  return request({
    url: `/product/category/info/${catId}`,
    method: "get"
  })
}

// 根据catId修改当前节点的数据
export function updateCategoryByCategory(category) {
  return request({
    url: "/product/category/update",
    method: "post",
    data: category
  })
}

// 拖拽节点之后修改节点的数据
export function updateCategory(category) {
  return request({
    url: "/product/category/update/sort",
    method: "post",
    data: category
  })
}